<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .a {
      width: 500px;
      height: 20px;
    }

    .b {
      float: left;
      left: 50%;
      position: relative;
      /* transform: translate(-50%) */
    }
  </style>
</head>

<body>
  <div class="a">
    <div class="b">aaaa</div>
  </div>
</body>

</html>